package com.zxmc.task;

import com.zxmc.common.context.BaseContext;
import com.zxmc.server.service.RecommendationService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;
import java.util.Date;

//@Component
@Slf4j
public class UpdateRecommendTask {
    @Autowired
    private RecommendationService recommendationService;
    @Scheduled(fixedRate = 10  * 1000) // 每 10 分钟执行一次
    public void myTask() {
        log.info("定时任务执行时间:{}", LocalDateTime.now());
        Integer currentId = BaseContext.getCurrentId();
        System.out.println(currentId);
        recommendationService.callRecommandFun(currentId);
    }
}
